/**
 * Created with IntelliJ IDEA.
 * Description:
 * https://gitee.com/li--jiaqiang/java-test.git
 * git pull
 * git pull origin master
 * git pull origin master --allow-unrelated-histories
 * User: 86187
 * Date: 2022-04-23
 * Time: 20:55
 */

//Scanner scan = new Scanner(System.in);

import java.util.Scanner;

public class TestDemo6 {

    public static void main(String[] args) {
        int[] nums1 = {0};
        int[] nums2 = {1,2,3,4,5};

        if(nums1.length == 0 && nums2.length == 0) {
            //return 0.0;
            System.out.println(0.0);
        }

        if(nums1.length == 0) {

            if(nums2.length == 1) {
                //return nums2[1]*1.0;
                System.out.println(nums2[1]*1.0);

            } else if(nums2.length % 2 == 0) {
                //return (nums2[nums2.length/2]+nums2[nums2.length/2-1])/2.0;
                System.out.println((nums2[nums2.length/2]+nums2[nums2.length/2-1])/2.0);

            } else {
                System.out.println(nums2[nums2.length / 2]*1.0);
            }
        }

        if(nums2.length == 0) {

            if(nums1.length == 1) {
                System.out.println(nums1[1] * 1.0);

            } else if(nums1.length % 2 == 0) {
                System.out.println((nums1[nums1.length / 2] + nums1[nums1.length / 2 - 1]) / 2.0);

            } else {
                System.out.println(nums1[nums1.length / 2] * 1.0);
            }
        }

        int i = 0, j = 0,k = 0;
        int newlength = nums1.length+nums2.length;
        int[] arr = new int[newlength];

        while(i < nums2.length && j < nums1.length) {
            if(nums1[j] < nums2[i]) {
                arr[k++] = nums1[j++];

            } else {
                arr[k++] = nums2[i++];

            }
        }

        if(i == nums2.length) {
            for(int m=j; m<nums1.length; m++) {
                arr[k++] = nums1[m];
            }
        } else {
            for(int n=i; n<nums2.length; n++) {
                arr[k++] = nums2[n];
            }
        }

        if(newlength % 2 == 0) {
            System.out.println((arr[newlength / 2] + arr[newlength / 2 - 1]) / 2.0);
        }else {
            System.out.println(arr[newlength / 2] * 1.0);
        }



    }

    public static void main5(String[] args) {

        int i = 0;
        int j = 0;
        for (j = 2; j <= 100; j++) {

            for (i = 2; i <= (int)Math.sqrt(j); i++) {
                if (j % i == 0 ) {
                    //System.out.println(j+"不是素数！");
                    break;
                }
            }
            if(i > (int)Math.sqrt(j) ) {
                System.out.print(j+" ");
            }
        }
    }





    public static void main2(String[] args) {

        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int i = 0;
        for (i = 2; i < a/2; i++) {
            if(a % i == 0) {
                System.out.println("不是素数！");
                break;
            }
        }
        if(i>=a/2)
            System.out.println("是素数！");
    }



    public static void main1(String[] args) {
        int count = 1;
        for(int i = 1000;i<=2000;++i) {
            if((i%4==0 && i%100!=0) || i%400 == 0) {
                System.out.printf("%d ",i);
                count++;
                if((count-1) % 30 == 0) {
                    System.out.println();
                }
            }
        }
    }
}
